home *** CD-ROM | disk | FTP | other *** search
/ PD ROM 1 / PD ROM Volume I - Macintosh Software from BMUG (1988).iso / Stacks / Hyper Education / Organizational Aids / Library Mngt / Library script < prev   
Encoding:
Text File  |  1987-09-18  |  9.7 KB  |  386 lines  |  [TEXT/ttxt]

  1. Scripts of Stripped Library
  2.  
  3. Statistics of the Stack
  4.  
  5. Contains 2 cards.
  6. Contains 2 backgrounds.
  7.  
  8. Script of stack
  9.  
  10. on doMenu theItem
  11.   if theItem is "First" then go to first card of this background
  12.   else
  13.     if theItem is "Next" then go to next card of this background
  14.     else
  15.       if theItem is "Prev" then go to previous card of this background
  16.       else
  17.         if theItem is "Last" then go to last card of this background
  18.         else pass doMenu
  19.       end if -- else Last
  20.     end if   -- else Prev
  21.   end if     -- else Next
  22. end doMenu
  23.  
  24. on arrowKey whichArrow
  25.   if whichArrow is right then go to next card of this background
  26.   else
  27.     if whichArrow is left then go to previous card of this background
  28.     else pass arrowKey
  29.   end if
  30. end arrowKey
  31.  
  32.  
  33. Script of Background  "Books"
  34.  
  35. on opencard
  36.   if field "By Whom" is empty then
  37.     hide background button "Return the Book"
  38.     set locktext of field "By Whom" to false
  39.   else
  40.     show background button "Return the Book"
  41.     set locktext of field "By Whom" to true
  42.   end if
  43. end opencard
  44.  
  45. on closecard
  46.   hide message box
  47.   repeat with index = 1 to 4
  48.     set locktext of field index to true
  49.   end repeat
  50. end closecard
  51.  
  52. on doMenu theItem
  53.   Global OK
  54.   if OK is true then pass doMenu
  55.   else -- (OK is false)
  56.     if theItem is "New Card" then
  57.       if field "title" is empty then answer "Not while this card is empty."
  58.       else pass doMenu
  59.     else pass doMenu
  60.   end if
  61. end doMenu
  62.  
  63.  
  64. Script of Background "Index"
  65.  
  66. on doMenu theItem
  67.   if theItem is "Delete Card" then
  68.     answer "Delete an entire index card?"with "OK" or "Cancel"
  69.     if it is "OK"
  70.     then pass doMenu
  71.     else exit doMenu
  72.   else if theItem is "Cut Card" or theItem is "Paste Card" then
  73.     answer "Sorry, not with the index."
  74.   else pass doMenu
  75. end doMenu
  76.  
  77. on mouseUp
  78.   visual barn door open
  79.   get the short name of target
  80.   go to card it
  81. end mouseUp
  82.  
  83.  
  84. Script(s) of Background Field(s) of background # "Books"
  85.  
  86. Script of Background Field #1:  bkgnd field "Title"
  87. on closefield
  88.   if the length of field "title" > 30 then
  89.     answer "Sorry, there is a 30 character title limit."
  90.     exit closefield
  91.   end if
  92.   put field 1 into title
  93.   set the name of this card to title
  94.   pass closefield
  95. end closefield
  96.  
  97. Script of Background Field #5:  bkgnd field "By Whom"
  98. on closefield
  99.   if field "By Whom" <> "" then
  100.     set locktext of field "By whom" to true
  101.     put the date into field date
  102.     convert the date to dateItems
  103.     put item 1 of it into year
  104.     put item 2 of it into month
  105.     put item 3 of it into day
  106.     subtract 1900 from year
  107.     if month <> 12 then
  108.       add 1 to month
  109.     else
  110.       put 1 into month
  111.       add 1 to year
  112.     end if
  113.     put month & "/" & day & "/" & year into theDueDate
  114.     put theDueDate into field duedate
  115.     show background button "Return the Book"
  116.   end if
  117. end closefield
  118.  
  119.  
  120. Script(s) of Background Button(s) of background “Books”
  121.  
  122. Script of Background Button #1:  bkgnd button "Prev"
  123. on mouseUp
  124.   visual effect wipe right
  125.   go to previous card of this background
  126. end mouseUp
  127.  
  128.  
  129. Script of Background Button #2:  bkgnd button "Next"
  130. on mouseUp
  131.   visual effect wipe left
  132.   go to next card of this background
  133. end mouseUp
  134.  
  135.  
  136. Script of Background Button #3:  bkgnd button "Home"
  137. on mouseUp
  138.   visual effect iris open
  139.   go Home
  140. end mouseUp
  141.  
  142.  
  143. Script of Background Button #4:  bkgnd button "Find"
  144. on mouseUp
  145.   domenu find...
  146. end mouseUp
  147.  
  148.  
  149. Script of Background Button #5:  bkgnd button "first Card"
  150. on mouseUp
  151.   visual barn door open
  152.   go to first card of this background
  153. end mouseUp
  154.  
  155.  
  156. Script of Background Button #6:  bkgnd button "Last Card"
  157. on mouseUp
  158.   visual barn door close
  159.   go to last card of this background
  160. end mouseUp
  161.  
  162.  
  163. Script of Background Button #7:  bkgnd button "Sort"
  164. on mouseUp
  165.   Global OK
  166.   put true into OK -- OK to doMenu New Card
  167.   set lockscreen to true
  168.   sort by field "title"
  169.   choose button tool
  170.   go to first card of background "books"
  171.   put the number of this card into begin
  172.   put begin into targetCard
  173.   hide background button "add to index"
  174.   repeat with counter = begin to number of cards
  175.     put 100 + counter mod 8 into cursorNum
  176.     set cursor to cursorNum
  177.     go to card targetCard
  178.     add 1 to targetCard
  179.     put the short name of this card into nameHolder
  180.     put (counter - begin) div 12 + 1 into CardNum
  181.     put (counter - begin) mod 12 + 1 into ButtonNum
  182.     go to card CardNum
  183.     get short name of background
  184.     if it is "Index" then
  185.       if number of buttons >= buttonNum then
  186.         set name of button buttonNum to nameHolder
  187.       else              -- (Number of buttons is less than buttonNum)
  188.         if number of buttons < 12 then
  189.           put number of buttons into lastButton
  190.           get location of button lastButton
  191.           put item 1 of it into horiz
  192.           put item 2 of it into vert
  193.           drag from horiz,vert to horiz,vert+21 with optionKey
  194.           add 1 to lastButton
  195.           set the name of button lastButton to nameHolder
  196.         end if          -- number of buttons < 12
  197.       end if            -- number of buttons >= buttonNum
  198.     else                -- (background is not "Index")
  199.       go to last card of background "Index"
  200.       click at loc of button 1
  201.       doMenu copy button
  202.       doMenu New Card
  203.       doMenu Paste Button
  204.       set the name of button 1 to nameHolder
  205.       add 1 to targetCard
  206.     end if              -- it is "Index"
  207.   end repeat
  208.   choose browse tool
  209.   go to first card of background "Index"
  210.   set lockscreen to false
  211.   put false into OK
  212. end mouseUp
  213.  
  214.  
  215. Script of Background Button #8:  bkgnd button "Add a New Book"
  216. on mouseUp
  217.   domenu new card
  218.   repeat with index = 1 to 4
  219.     set locktext of field index to false
  220.   end repeat
  221.   show background button "Add to Index"
  222.   type tab
  223. end mouseUp
  224.  
  225.  
  226. Script of Background Button #9:  bkgnd button "Return the Book"
  227. on mouseUp
  228.   set locktext of field "By whom" to false
  229.   put empty into field "by whom" -- null
  230.   put empty into field date -- null
  231.   put empty into field duedate -- null
  232.   hide background button "Return the Book"
  233. end mouseUp
  234.  
  235.  
  236. Script of Background Button #10:  bkgnd button "Look at all"
  237. on mouseUp
  238.   show all cards
  239. end mouseUp
  240.  
  241.  
  242. Script of Background Button #11:  bkgnd button "Modify Data"
  243. on mouseUp
  244.   repeat with index = 1 to 4
  245.     set locktext of field index to false
  246.   end repeat
  247.   type tab
  248. end mouseUp
  249.  
  250.  
  251. Script of Background Button #12:  bkgnd button "Add to Index"
  252. on mouseUp
  253.   put field 1 into title
  254.   set the name of this card to title
  255.   push this card
  256.   set lockscreen to true
  257.   go to last card of background "Index"
  258.   set the userLevel to 4
  259.   choose button tool
  260.   if number of buttons < 12 then
  261.     put number of buttons into ButtonNum
  262.     get loc of button ButtonNum
  263.     put item 1 of it into horiz
  264.     put item 2 of it into vert
  265.     drag from horiz,vert to horiz,vert+21 with optionKey
  266.     add 1 to buttonNum
  267.     set the name of button buttonNum to title
  268.   else
  269.     click at loc of button 1
  270.     doMenu copy button
  271.     doMenu New Card
  272.     doMenu paste button
  273.     set the name of button 1 to title
  274.   end if
  275.   choose browse tool
  276.   set the userLevel to 2
  277.   pop card
  278.   set lockscreen to false
  279.   hide background button "Add to Index"
  280. end mouseUp
  281.  
  282.  
  283. Script of Background Button #13:  bkgnd button "Index"
  284. on mouseUp
  285.   visual barn door close
  286.   go to background index
  287. end mouseUp
  288.  
  289.  
  290. Script(s) of Background Button(s) of background “Index”
  291.  
  292. Script of Background Button #1
  293. on mouseUp
  294.   visual effect iris open
  295.   go Home
  296. end mouseUp
  297.  
  298.  
  299. Script of Background Button #2:  bkgnd button "first Card"
  300. on mouseUp
  301.   visual iris close
  302.   go to first card of this background
  303. end mouseUp
  304.  
  305.  
  306. Script of Background Button #3:  bkgnd button "Prev"
  307. on mouseUp
  308.   visual effect wipe down
  309.   go to previous card of this background
  310. end mouseUp
  311.  
  312.  
  313. Script of Background Button #4:  bkgnd button "Next"
  314. on mouseUp
  315.   visual effect wipe up
  316.   go to next card of this background
  317. end mouseUp
  318.  
  319.  
  320. Script of Background Button #5:  bkgnd button "Last Card"
  321. on mouseUp
  322.   visual iris open
  323.   go to last card of this background
  324. end mouseUp
  325.  
  326.  
  327. Script of Background Button #6:  bkgnd button "Find"
  328. on mouseUp
  329.   domenu find...
  330. end mouseUp
  331.  
  332.  
  333. Script of Background Button #7:  bkgnd button "Look at all"
  334. on mouseUp
  335.   show all cards
  336. end mouseUp
  337.  
  338.  
  339. Script of Background Button #8:  bkgnd button "Sort"
  340. on mouseUp
  341.   global level
  342.   set lockscreen to true
  343.   sort by field "title"
  344.   choose button tool
  345.   go to first card of background "books"
  346.   put the number of this card into begin
  347.   put begin into targetCard
  348.   hide background button "add to index"
  349.   repeat with counter = begin to number of cards
  350.     put 100 + counter mod 8 into cursorNum
  351.     set cursor to cursorNum
  352.     go to card targetCard
  353.     add 1 to targetCard
  354.     put the short name of this card into nameHolder
  355.     put (counter - begin) div 12 + 1 into CardNum
  356.     put (counter - begin) mod 12 + 1 into ButtonNum
  357.     go to card CardNum
  358.     get short name of background
  359.     if it is "Index" then
  360.       if number of buttons >= buttonNum then
  361.         set name of button buttonNum to nameHolder
  362.       else              -- (Number of buttons is less than buttonNum)
  363.         if number of buttons < 12 then
  364.           put number of buttons into lastButton
  365.           get location of button lastButton
  366.           put item 1 of it into horiz
  367.           put item 2 of it into vert
  368.           drag from horiz,vert to horiz,vert+21 with optionKey
  369.           add 1 to lastButton
  370.           set the name of button lastButton to nameHolder
  371.         end if          -- number of buttons < 12
  372.       end if            -- number of buttons >= buttonNum
  373.     else                -- (background is not "Index")
  374.       go to last card of background "Index"
  375.       click at loc of button 1
  376.       doMenu copy button
  377.       doMenu New Card
  378.       doMenu Paste Button
  379.       set the name of button 1 to nameHolder
  380.       add 1 to targetCard
  381.     end if              -- it is "Index"
  382.   end repeat
  383.   choose browse tool
  384.   go to first card of background "Index"
  385.   set lockscreen to false
  386. end mouseUp